<html>
<head><meta charset="utf-8"><title>options() versus top-level options · project-inline-asm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/index.html">project-inline-asm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html">options() versus top-level options</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="186205668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186205668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186205668">(Jan 21 2020 at 17:22)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> Thanks for the updates to the RFC. Do you have thoughts on the proposal to take the parameters of <code>options()</code> and make them top-level parameters of <code>asm!</code> instead? That seems like a useful simplification for anyone actually using options.</p>



<a name="186205752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186205752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186205752">(Jan 21 2020 at 17:23)</a>:</h4>
<p>That would prevent us from using options that could get mistaken for <code>in</code>/<code>out</code> and similar, but that doesn't seem like a problem.</p>



<a name="186226136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186226136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186226136">(Jan 21 2020 at 20:54)</a>:</h4>
<p>Eh, I'm somewhat torn on this issue. There's a lot of freedom in how we can deal with options.</p>



<a name="186226146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186226146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186226146">(Jan 21 2020 at 20:54)</a>:</h4>
<p>For example, we could remove the requirement that they appear at the end of the argument list.</p>



<a name="186226194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186226194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186226194">(Jan 21 2020 at 20:55)</a>:</h4>
<p>But I think this is getting into bikeshed territory: it doesn't <em>really</em> matter what option we pick, people will just go with it.</p>



<a name="186313632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186313632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186313632">(Jan 22 2020 at 18:13)</a>:</h4>
<p>I don't think they'd need to appear at the end of the argument list either way. We would just need to ensure that they have unique names.</p>



<a name="186313958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186313958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186313958">(Jan 22 2020 at 18:16)</a>:</h4>
<p>One reason for putting them at the end is that they make positional arguments more confusing</p>



<a name="186313983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186313983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186313983">(Jan 22 2020 at 18:16)</a>:</h4>
<p>That's <em>completely</em> fair, but it's also true whether they're wrapped in <code>options()</code> or not.</p>



<a name="186314003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314003">(Jan 22 2020 at 18:17)</a>:</h4>
<p>I do actually prefer requiring that they appear at the end.</p>



<a name="186314054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314054">(Jan 22 2020 at 18:17)</a>:</h4>
<p>I'm just suggesting that the following seems reasonable to me:</p>
<div class="codehilite"><pre><span></span><span class="w">    </span><span class="n">asm</span><span class="o">!</span><span class="p">(</span><span class="w"></span>
<span class="w">        </span><span class="s">&quot;add {0}, {1}&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">inlateout</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="k">in</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">b</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="kr">pure</span><span class="p">,</span><span class="w"> </span><span class="n">nomem</span><span class="p">,</span><span class="w"> </span><span class="n">nostack</span><span class="w"></span>
<span class="w">    </span><span class="p">);</span><span class="w"></span>
</pre></div>



<a name="186314179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314179">(Jan 22 2020 at 18:18)</a>:</h4>
<p>I'm worried that the options might get confused with operands as we add more operand types.</p>



<a name="186314213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314213">(Jan 22 2020 at 18:19)</a>:</h4>
<p>one alternative is to move the options to e.g. an attribute atop the macro? not sure how that would fare though</p>



<a name="186314223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314223">(Jan 22 2020 at 18:19)</a>:</h4>
<p>but that is pretty clearly "separate"</p>



<a name="186314235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314235">(Jan 22 2020 at 18:19)</a>:</h4>
<p>Such as those listed in the future work section of the RFC: <code>fallthrough</code> and <code>label</code> for asm goto, <code>flag_out</code>, etc.</p>



<a name="186314242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314242">(Jan 22 2020 at 18:19)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> Attributes on expressions seem a little more confusing to read, to me.</p>



<a name="186314261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314261">(Jan 22 2020 at 18:20)</a>:</h4>
<p>hm, I think of <code>asm!</code> as more of an item</p>



<a name="186314317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314317">(Jan 22 2020 at 18:20)</a>:</h4>
<p>but yes, that's true</p>



<a name="186314332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314332">(Jan 22 2020 at 18:20)</a>:</h4>
<p>My personal feeling is to leave it as <code>options()</code>. But this is very easy to change if we decide otherwise in the future.</p>



<a name="186314344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314344">(Jan 22 2020 at 18:20)</a>:</h4>
<p>I'm suggesting that we should decide this in the RFC.</p>



<a name="186314356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314356">(Jan 22 2020 at 18:20)</a>:</h4>
<p>I certainly agree that it will make <em>slightly</em> more work for us in the parser.</p>



<a name="186314374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314374">(Jan 22 2020 at 18:21)</a>:</h4>
<p>The tradeoff is that every single user of <code>asm!</code> will get simpler syntax.</p>



<a name="186314421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314421">(Jan 22 2020 at 18:21)</a>:</h4>
<p>We just have to make sure we don't create option names that conflict with the other types of arguments you can pass to <code>asm!</code>. That doesn't seem especially problematic.</p>



<a name="186314428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314428">(Jan 22 2020 at 18:21)</a>:</h4>
<p>it is true that we can stop <em>requiring</em> options later, right?</p>



<a name="186314430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186314430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186314430">(Jan 22 2020 at 18:21)</a>:</h4>
<p>(For instance, we can't name an option <code>lateout</code>. ;) )</p>



<a name="186316621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186316621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186316621">(Jan 22 2020 at 18:40)</a>:</h4>
<p>I absolutely understand that <code>options()</code> makes the parser a little simpler. But do you see any fundamental limitations we'd have without it that justify making everyone write it for every asm that has options?</p>



<a name="186333226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186333226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186333226">(Jan 22 2020 at 21:32)</a>:</h4>
<p>could the options list at the end be "transitioned to" with a separation other than <code>,</code>? Such as using <code>;</code> to show the larger distinction.</p>
<div class="codehilite"><pre><span></span><span class="w">    </span><span class="n">asm</span><span class="o">!</span><span class="p">(</span><span class="w"></span>
<span class="w">        </span><span class="s">&quot;add {0}, {1}&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">inlateout</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="k">in</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">b</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="kr">pure</span><span class="p">,</span><span class="w"> </span><span class="n">nomem</span><span class="p">,</span><span class="w"> </span><span class="n">nostack</span><span class="w"></span>
<span class="w">    </span><span class="p">);</span><span class="w"></span>
</pre></div>



<a name="186334693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186334693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186334693">(Jan 22 2020 at 21:50)</a>:</h4>
<p>It <em>could</em> be, but that seems like a syntax annoyance to have to remember, and one that people will regularly forget.</p>



<a name="186334733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186334733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186334733">(Jan 22 2020 at 21:51)</a>:</h4>
<p>(To the point that I think we'd end up making the parser handle <code>,</code> <em>anyway</em> just to give good error messages, at which point we could just make that the syntax.)</p>



<a name="186335904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186335904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186335904">(Jan 22 2020 at 22:04)</a>:</h4>
<p>Yeah I think all <code>,</code> is best, but I'm also not personally worried about template param order getting confused even with top level options (which I'm in favor of), so it's hard to understand a good fix.</p>
<p>We could make <em>all</em> the separations be flexible? Like how macros accept any outer grouping as a legal way to use them?</p>



<a name="186336781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186336781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186336781">(Jan 22 2020 at 22:14)</a>:</h4>
<p>Don't worry about the parser complexity, that is absolutely trivial compared to the rest of the work.</p>



<a name="186336828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186336828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186336828">(Jan 22 2020 at 22:15)</a>:</h4>
<p>I don't have any strong objections on either <code>options()</code> or top-level options: both would likely work fine in practice.</p>



<a name="186339130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186339130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186339130">(Jan 22 2020 at 22:39)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> If you don't have any objections to either, then I do have a preference for top-level options, to reduce the verbosity of <code>asm!</code> statements.</p>



<a name="186339155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186339155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186339155">(Jan 22 2020 at 22:40)</a>:</h4>
<p>Ok then, let's do that.</p>



<a name="186340997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186340997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186340997">(Jan 22 2020 at 23:04)</a>:</h4>
<p>Thank you.</p>



<a name="186341456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186341456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186341456">(Jan 22 2020 at 23:10)</a>:</h4>
<p>Actually I just thought of a possible argument for keeping <code>options()</code>: it looks better when operands are formatted on a separate line each, since the options are all on one line.</p>



<a name="186341461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186341461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186341461">(Jan 22 2020 at 23:10)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="n">asm</span><span class="o">!</span><span class="p">(</span><span class="w"></span>
<span class="w">    </span><span class="s">&quot;longer asm {x} {y} {z}&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">in</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">long_expression_1</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">in</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">long_expression_2</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">z</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">out</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">long_destination_3</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">options</span><span class="p">(</span><span class="n">nomem</span><span class="p">,</span><span class="w"> </span><span class="kr">pure</span><span class="p">,</span><span class="w"> </span><span class="n">nostack</span><span class="p">,</span><span class="w"> </span><span class="n">preserves_flags</span><span class="p">),</span><span class="w"></span>
<span class="p">);</span><span class="w"></span>
</pre></div>



<a name="186342034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186342034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186342034">(Jan 22 2020 at 23:19)</a>:</h4>
<p>We can absolutely propose a formatting of <code>asm!</code> that puts options on the same line even if they're not inside <code>options()</code>.</p>



<a name="186342040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186342040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186342040">(Jan 22 2020 at 23:19)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="n">asm</span><span class="o">!</span><span class="p">(</span><span class="w"></span>
<span class="w">    </span><span class="s">&quot;longer asm {x} {y} {z}&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">in</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">long_expression_1</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">in</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">long_expression_2</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">z</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">out</span><span class="p">(</span><span class="n">reg</span><span class="p">)</span><span class="w"> </span><span class="n">long_destination_3</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">nomem</span><span class="p">,</span><span class="w"> </span><span class="kr">pure</span><span class="p">,</span><span class="w"> </span><span class="n">nostack</span><span class="p">,</span><span class="w"> </span><span class="n">preserves_flags</span><span class="p">,</span><span class="w"></span>
<span class="p">);</span><span class="w"></span>
</pre></div>



<a name="186342064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/options%28%29%20versus%20top-level%20options/near/186342064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/options().20versus.20top-level.20options.html#186342064">(Jan 22 2020 at 23:19)</a>:</h4>
<p>That's how I would want to format that, personally.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>